<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AlterVulsrecordAddDistributeTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('vuls_record', function (Blueprint $table) {
            //
            $table->integer('distribute_id')->nullable()->comment('漏洞分发表id');
            $table->integer('user_id')->nullable()->comment('被分发者id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if (Schema::hasColumn('vuls_record', 'distribute_id')){
            Schema::table('vuls_record', function (Blueprint $table) {
                $table->dropColumn('distribute_id');
            });
        }
        if (Schema::hasColumn('vuls_record', 'user_name')){
            Schema::table('vuls_record', function (Blueprint $table) {
                $table->dropColumn('user_name');
            });
        }
    }
}
